package android.medicalcloud.com.yiapp.yilian.im.model;

import com.tencent.TIMFriendFutureItem;
import com.tencent.TIMFutureFriendType;

import java.net.URLDecoder;

/**
 * 好友关系链消息的界面绑定数据
 * 可用于本地操作后界面修改
 */
public class FriendFuture {

    TIMFriendFutureItem futureItem;

    private TIMFutureFriendType type;

    public FriendFuture(TIMFriendFutureItem item){
        futureItem = item;
        type = futureItem.getType();
    }


    public TIMFutureFriendType getType() {
        return type;
    }

    public void setType(TIMFutureFriendType type) {
        this.type = type;
    }

    public String getName(){
        if (futureItem.getProfile().getNickName().equals("")){
            return futureItem.getIdentifier();
        }else {
            try {
                return URLDecoder.decode(futureItem.getProfile().getNickName(),"UTF-8");
            }catch (Exception e){
                return futureItem.getProfile().getNickName();
            }
        }
    }

    public String getMessage(){
        return futureItem.getAddWording();
    }


    public String getIdentify(){
        return futureItem.getIdentifier();
    }

    public TIMFriendFutureItem getFutureItem() {
        return futureItem;
    }
}
